<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>

</head>
<body>
<input type="button" value="点我" id="btn">
<input type="button" value="点我" id="btn2">
<script>


    (function () {
        var bb = document.getElementById('btn');
        console.log(bb);
    }())
    console.log(bb);


</script>
</body>
</html>